<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="css/common.css" type="text/css" />
<link href="css/adminstyle.css" rel="stylesheet" type="text/css">
<link href="js/uploadify/uploadify.css" rel="stylesheet" type="text/css">
<title>管理区域</title>
<script language="javascript" type="text/javascript" src="My97DatePicker/WdatePicker.js"></script>
<link href="css/ui-lightness/jquery-ui-1.10.3.custom.min.css" rel="stylesheet" type="text/css">
<script language="javascript" type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery-ui-1.10.3.custom.js"></script>
<script language="javascript" type="text/javascript" src="js/uploadify/swfobject.js"></script>
<script language="javascript" type="text/javascript" src="js/uploadify/jquery.uploadify.v2.1.4.min.js"></script>

</head>

<script>
$(function() {$( "#tabs" ).tabs();});
</script>

<script>

var select2 = new Array(<?=count($departmentList)?>);

<?

foreach($departmentList as $k=>$v){

?>

select2[<?=$k?>] = new Array();

select2[<?=$k?>][0] = new Option("请选择", "-1");

<?

foreach($homemade_producer_list[$k] as $k1=>$v1){

?>

	select2[<?=$k?>][<?=$k1+1?>] = new Option("<?=$v1['name']?>", "<?=$v1['id']?>");

<?

	}

}

?>

function redirec(x,dx,city){

	var temp = dx; 

	temp.options.length=0;

	for (i=0;i<select2[x].length;i++){
		temp.options[i]=new Option(select2[x][i].text,select2[x][i].value);

		if (city>0){
			if (select2[x][i].value==city){

				temp.options[i].selected=true;

			}

		}

	}

}

</script>

<body>
<div id="man_zone">
<div id="tabs" style="border:0; padding:0; background:none;">
	<ul style=" width:98%; margin:0 auto;">
		<li><a href="#tabs-1">基本信息</a></li>
		<li><a href="#tabs-2">其他信息</a></li>
</ul>

<div style="background-color:#FFFFFF ">
 <form  method="post" action="<? if  (empty($id)){ echo  'course_subAdd.html'; }else{ echo  'course_subUpdate.html'; }  ?>" ><input name="id" type="hidden" value="<?=$id?>">
<div id="tabs-1" style="padding:0; margin:0 auto;">
  <table width="98%" border="0" align="center"  cellpadding="3" cellspacing="1" class="tableborder" >

    <tr>

      <td width="10%"  class="left_title_2adminssd">教材名称</td>

      <td width="37%"   bgcolor="#FFFFFF"><input name="theme" type="text"  value="<?=getStr($extract_vars,'theme')?>" size="80" ></td>
      <td width="11%"   class="left_title_2adminssd">课程大类别</td>
      <td width="42%" bgcolor="#FFFFFF">
      <select name="english_type">
   		<?= page_modifier_options($english_type_pair,getStr($extract_vars, 'english_type'))?>
      </select>
      </td>
      </tr>
      <tr>
      <td class="left_title_2adminssd">教材分类</td>
      <td  bgcolor="#FFFFFF"><select name="type" >
      <?

      foreach ($course_types as $k=>$v){

	  ?>

        <option value="<?=$k?>" <?   if (getStr($extract_vars,'type')==$k){ echo 'selected="selected"'; }?>><?=$v?></option>

        <?

	  }

		?>

      </select></td>

      <td  class="left_title_2adminssd">编号</td>

      <td  bgcolor="#FFFFFF"> <?

      if (!empty($id)){

		  echo $serial_number;

		  ?>

	  <input name="" type="hidden" value="<?=getStr($extract_vars,'serial_number')?>" />

	  <? }

	  else{

	  ?> <input name="serial_number" type="text" value="<?=getStr($extract_vars,'serial_number')?>" id="serial_number" readonly />

      <?

	  }

	  ?></td>

      </tr>

      

        <tr>

      <td class="left_title_2adminssd">课时</td>

      <td  bgcolor="#FFFFFF"><input name="class_hour" type="text"  value="<?=getStr($extract_vars,'class_hour',1) ?>"></td>

      <td  class="left_title_2adminssd">等级</td>

      <td  bgcolor="#FFFFFF">

      <select name="level">

	   <?

	   	echo $levelOptions;

	   ?>

      </select>

      </td>

      </tr>

      <tr>

      <td  class="left_title_2adminssd">状态</td>

      <td colspan="1"  bgcolor="#FFFFFF">

      <select name="status">

      <?=$statusOptions?>

      </select>

      </td>
      <td width="11%"   class="left_title_2adminssd"></td>
      <td width="42%" bgcolor="#FFFFFF">
      </td>
      </tr>      

      <tr style="display:none" >

      <td align="center" class="left_title_2adminssd" >来源</td>

      <td colspan="3" align="left" >

      <div><input name="source" type="radio"  value="<?=COURSE_HOMEMADE?>" <?  if (getStr($extract_vars,'source')==COURSE_HOMEMADE ||getStr($extract_vars,'source')=='' ){echo 'checked="checked"';} ?> />自制

		<input name="source" type="radio" value="<?=COURSE_BOOK?>" <?  if (getStr($extract_vars,'source')==COURSE_BOOK){echo 'checked="checked"';} ?> />书本</div>

      </td>

      </tr>

	  <tr id="tr_course_self"   style="display:none">

	    <td class="left_title_2adminssd" id="td_course_sel_1" width="10%">制作时间</td>

	    <td width="40%"><input name="homemade_time" type="text"  onClick="WdatePicker()" value="<?=date('Y-m-d',getStr($extract_vars,'homemade_time',time()))?>" /> </td>

	    <td  class="left_title_2adminssd" width="10%">制作人</td>

	    <td width="40%">

		部门&nbsp;&nbsp;&nbsp;

      <select name="dept_id" id="dept_id"  onChange="redirec(this.value,document.getElementById('homemade_producer'))"   >

        <option value="-1">请选择</option>

          <?

          foreach ($departmentList as $k=>$v){

		  ?>

       	 <option value="<?=$k?>"  <?  if (isset($dept_id)){ if ($dept_id==$k){ echo 'selected="selected"';   } } ?> ><?=$v?></option>

       	 <?

		  }

		?>

      </select>

               员工&nbsp;&nbsp;&nbsp;<?php getStr($extract_vars,'homemade_producer')?>

      <select name="homemade_producer" id="homemade_producer" >

      </select>

      <script>

		<?

		if (!empty($dept_id)){?>

			redirec(document.getElementById('dept_id').value,document.getElementById('homemade_producer'),<?=getStr($extract_vars,'homemade_producer')?>);

		 <?	

		 }

		?>

	</script>

	    </td>

	  </tr>

	  <tr id="tr_course_public_1" style="display:none;">

	    <td class="left_title_2adminssd" id="td_course_public_1" width="10%">条形码</td>

	    <td  bgcolor="#FFFFFF"><input name="book_barcode" value="<?=getStr($extract_vars,'book_barcode')?>" type="text" /></td>
	  </tr>

	    <tr id="tr_course_public_2" style="display:none;">

	    <td class="left_title_2adminssd">版本</td>

	    <td  bgcolor="#FFFFFF"><input name="book_version" value="<?=getStr($extract_vars,'book_version')?>" type="text" /></td>

	    <td class="left_title_2adminssd">时间</td>

	    <td  bgcolor="#FFFFFF">  <input name="book_time" type="text"  onClick="WdatePicker()" value="<?=date('Y-m-d',getStr($extract_vars,'book_time',time()))?>" /></td>

	  </tr>
	    <tr>
	      <td class="left_title_2adminssd">章节数</td>
	      <td  bgcolor="#FFFFFF">
	      <input name="book_chapter_number" value="<?=getStr($extract_vars,'book_chapter_number')?>" type="text" /></td>
	      <td  class="left_title_2adminssd">教材链接(购买)</td>
	      <td  bgcolor="#FFFFFF"><input type="text" value="<?=getStr($extract_vars,'course_url')?>" name="course_url" size="60"></td>
	    </tr>
      </td>
      </tr>
      <tr>
      <td class="left_title_2adminssd" style="height:100px;">目录</td>
      <td colspan="1" bgcolor="#FFFFFF">
	      <?php $display_style='none'; $upload_value="";?>
	      <?if(getStr($extract_vars,'teaching_material')!=""){?>
		  		<?  $display_style='inline-block';?>
		  		<?  $upload_value=htmlspecialchars(getStr($extract_vars,'teaching_material'));?>
	      <?}?>
	      <input id="file_upload_teaching_material" name="file_upload_teaching_material" class="file_upload" type="file" multiple="true">
	      <br>
	      <a href="javaScript:void(0);" class="del_file" style="display:<?=$display_style?>">&nbsp;&nbsp;&nbsp;&nbsp;删除附件</a>
	      <a class="file_link" href="../<?=$upload_value?>" target="_blank" style="display:<?=$display_style?>"/>查看</a>
	      <input type="hidden" class="file_src" name="teaching_material" value="<?=$upload_value?>" id="teaching_material" >
      </td>
      <td class="left_title_2adminssd">出版社</td>

	    <td  bgcolor="#FFFFFF">
	    	<select name="book_press">
	    		<?=page_modifier_options_ext($book_press_pair,getStr($extract_vars,'book_press'))?>
	    	</select>
	    </td>
      </tr>
      <tr>
      <td class="left_title_2adminssd" style="height:100px;">教材图片</td>
      <td colspan="1" bgcolor="#FFFFFF">
	      <?php $display_style='none'; $upload_value="";?>
	      <?if(getStr($extract_vars,'course_img')!=""){?>
		  		<?  $display_style='inline-block';?>
		  		<?  $upload_value=htmlspecialchars(getStr($extract_vars,'course_img'));?>
	      <?}?>
	      <input id="file_upload_course_img" name="file_upload_course_img" class="file_upload" type="file" multiple="true">
	      <br>
	      <a href="javaScript:void(0);" class="del_file" style="display:<?=$display_style?>">&nbsp;&nbsp;&nbsp;&nbsp;删除附件</a>
	      <a class="file_link" href="../<?=$upload_value?>" target="_blank" style="display:<?=$display_style?>"/>查看</a>
	      <input type="hidden" class="file_src" name="course_img" value="<?=$upload_value?>" id="course_img" >
      </td>
        <td class="left_title_2adminssd">推荐</td>
      	<td  bgcolor="#FFFFFF">
	    		<input type="checkbox" name="course_recommend" value="1" id="course_recommend"
	    		<?if(getStr($extract_vars,'course_recommend')=='1'){?>
	    		checked
	    		<?}?>
	    		>推荐
	    </td>
     <tr>
      <td class="left_title_2adminssd" style="height:100px;">适合目的</td>
    	<td  bgcolor="#FFFFFF">
	    		<?=page_modifier_checkboxs('for_purpose_study',$for_purpose_study_pair,getStr($extract_vars,'for_purpose_study'),1)?>
	    </td>
        <td class="left_title_2adminssd">适合目标</td>
	    <td  bgcolor="#FFFFFF">
	    		<?=page_modifier_checkboxs('for_purpose_people',$for_purpose_people_pair,getStr($extract_vars,'for_purpose_people'),4)?>
	    </td>
      </tr>      
</table>
</div>
	<script type="text/javascript">
    $(document).ready(function() {
		$(function() {
			$('.file_upload').uploadify({
		        'uploader'  : 'js/uploadify/uploadify.swf',
		        'script'    : 'js/uploadify/uploadify.php',
		        'cancelImg' : 'js/uploadify/cancel.png',
		        'folder'    : '1',
		        'auto'      : true,
		        'fileExt'   : '*.pdf;*.txt;*.jpg;*.gif;',
		        'fileDesc'  : 'Web Image Files (.PDF,*.TXT,*.JPG,*.GIF)',
		        'sizeLimit' : '8697152',
		        'onComplete'  : function(event, ID, fileObj, response, data) {
		          $("#" + $(event.target).attr("id")).nextAll(".del_file").show();
		          $("#" + $(event.target).attr("id")).nextAll(".file_src").val(response);
		          $("#" + $(event.target).attr("id")).nextAll(".file_link").attr("href","../"+response);
		          $("#" + $(event.target).attr("id")).nextAll(".file_link").show();
		        }		        
			});
		});
    });	
    
    $(".del_file").click(
        function()
        {
          if(confirm("您确认要删除该附件么？"))
          {
            $(this).hide();
            $(this).nextAll(".file_src").val("");
            $(this).nextAll(".file_link").attr("href","");
            $(this).nextAll(".file_link").hide();
            alert("附件已成功删除");
          }
        }
    )
	</script>
<div  id="tabs-2"  style="padding:0; margin:0 auto;">
  <table width="98%" border="0" align="center"  cellpadding="3" cellspacing="1" class="tableborder">
       <tr>
            <td  class="left_title_2adminssd">概述</td>
      		<td colspan="3" bgcolor="#FFFFFF">
      		<?=$ueditor_overview?></td>
      </tr>
       <tr>
      	<td class="left_title_2adminssd">描述</td>
      	<td colspan="3" bgcolor="#FFFFFF">
      	<?=$ueditor_describe?></td>
      </tr>
  </table>
</div>

<div>

<table width="98%" cellpadding="0" cellspacing="0" class="tablenoborder" align="center">
    <tr bgcolor="#FFFFFF">
      <td colspan="12" align="center" >
      <input name="" type="button" class="PublicBot" value="返回" onclick="location.href='course_lists.html'" />
      &nbsp;
        <input class="PublicBot" name="" type="submit" value="提交" />      </td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td colspan="12" align="center" >
      &nbsp;
    </tr>
</table>

</div>    

</form>

</div>
</div>
</div>

</body>

</html>

